(function ($, window, document, undefined) {

$(document).ready(function() {
	
	$klass = $.klass;
	$proto = $klass.prototype;
	$trait = $.trait;
	Trait = $klass.Trait;
	
	module("Wiki Proxy");
	
	test("", function() {
		
	// Proxys and binding methods to events
		button = $( "<div />" );
		
		Countdown = $.klass({
		  init: function( from ) {
			this.count = from;
		  },
		  step: function( ) {
			if( this.count > 0 ) this.count--;
		  },
		  hasEnded: function( ) {
			return this.count === 0;
		  }
		});
		
		counter = new Countdown( 10 );  // The countdown starts at 10.
		button.click( counter._proxy( "step" ) );  // Each click decrements the counter.
		
		strictEqual(counter.hasEnded(), false, "counter.hasEnded()");  // => false
		
		
		// Now we simulate 20 clicks on the button:
		for ( var i = 0; i < 20; i++ ) button.click();
		
		strictEqual(counter.hasEnded(), true, "counter.hasEnded()");  // => true
	});
});

})(jQuery, window, window.document);